﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Search;

namespace YourCompany.Modules.Cafeteria
{
	public class AnnouncementController
	{

		#region public method

		public List<Announcement> GetAnnouncementList()
		{
			return CBO.FillCollection<Announcement>(DataProvider.Instance().GetAnnouncementList());
		}

		public Announcement GetAnnouncement(int NewsID)
		{
			return (Announcement)CBO.FillObject(DataProvider.Instance().GetAnnouncement(NewsID), typeof(Announcement));
		}

		public void AddAnnouncement(Announcement announcement)
		{
			DataProvider.Instance().AddAnnouncement(announcement.Time, announcement.Title, announcement.Detail);
		}

		public void UpdateAnnouncement(Announcement announcement)
		{
			DataProvider.Instance().UpdateAnnouncement(announcement.NewsID, announcement.Time, announcement.Title, announcement.Detail);
		}

		public void DeleteAnnouncement(Announcement announcement)
		{
			DataProvider.Instance().DeleteAnnouncement(announcement.NewsID);
		}

		#endregion

	}
}
